package groothandel.service;

import groothandel.model.Bestelling;
import groothandel.model.Order;

import java.util.Random;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/groothandel")
public class GroothandelService {
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/bestel")
	@Consumes(MediaType.TEXT_XML)
	public Order maakBestelling(Bestelling bestelling) {
		Order order = new Order();
		order.setGroothandel(bestelling.getGroothandel());
		order.setProducten(bestelling.getProducten());

		Random random = new Random();
		order.setOrderNr(random.nextInt(1000));
		return order;
	}
}
